package com.demo.service.sys.impl;

import com.demo.common.constant.type.SysCatalogTypeConstant;
import com.demo.dao.common.entity.CatalogItem;
import com.demo.dao.sys.mapper.SysCatalogMapper;
import com.demo.service.sys.SysCatalogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service
public class SysCatalogServiceImpl implements SysCatalogService {
    @Autowired
    private SysCatalogMapper catalogMapper;

    //******************************************************************
    // 字典分类表
    //******************************************************************
    //查询企业类型列表
    @Override
    public List<CatalogItem> getCompanyTypeCatalogList(){
        return catalogMapper.getDictionaryCatalogListByTypeName(SysCatalogTypeConstant.COMPANY_TYPE_CODE);
    }
    //查询状态列表
    @Override
    public List<CatalogItem> getStatusTypeCatalogList(){
        return catalogMapper.getDictionaryCatalogListByTypeName(SysCatalogTypeConstant.STATUS_TYPE_CODE);
    }
    //查询职位列表
    @Override
    public List<CatalogItem> getPositionTypeCatalogList(){
        return catalogMapper.getDictionaryCatalogListByTypeName(SysCatalogTypeConstant.POSITION_TYPE_CODE);
    }
    //查询图形类型列表
    @Override
    public List<CatalogItem> getGraphTypeCatalogList(){
        return catalogMapper.getDictionaryCatalogListByTypeName(SysCatalogTypeConstant.GRAPH_TYPE_CODE);
    }

    //查询操作类型列表
    @Override
    public List<CatalogItem> getSexTypeCatalogList(){
        return catalogMapper.getDictionaryCatalogListByTypeName(SysCatalogTypeConstant.SEX_TYPE_CODE);
    }

    //查询菜单类型列表
    @Override
    public List<CatalogItem> getMenuTypeCatalogList() {
        return catalogMapper.getDictionaryCatalogListByTypeName(SysCatalogTypeConstant.MENU_TYPE_CODE);
    }

    //查询图标分类
    @Override
    public List<CatalogItem> getIconTypeCatalogList() {
        return catalogMapper.getDictionaryCatalogListByTypeName(SysCatalogTypeConstant.ICON_TYPE_CODE);
    }

    //查询图元分类
    @Override
    public List<CatalogItem> getTupleTypeCatalogList() {
        return catalogMapper.getDictionaryCatalogListByTypeName(SysCatalogTypeConstant.TUPLE_TYPE_CODE);
    }


    //查询应用领域分类
    @Override
    public List<CatalogItem> getFieldTypeCatalogList() {
        return catalogMapper.getDictionaryCatalogListByTypeName(SysCatalogTypeConstant.FIELD_TYPE_CODE);
    }


    //查询权限组件分类
    @Override
    public List<CatalogItem> getPermissionComponentTypeCatalogList() {
        return catalogMapper.getDictionaryCatalogListByTypeName(SysCatalogTypeConstant.PERMISSION_COMPONENT_TYPE_CODE);
    }

    //查询权限操作分类
    @Override
    public List<CatalogItem> getPermissionOperateTypeCatalogList() {
        return catalogMapper.getDictionaryCatalogListByTypeName(SysCatalogTypeConstant.PERMISSION_OPERATE_TYPE_CODE);
    }

    //******************************************************************
    // 普通表
    //******************************************************************
    //查询公司列表
    @Override
    public List<CatalogItem> getCompanyCatalogList(){
        return catalogMapper.getCompanyCatalogList();
    }

    //查询部门列表
    @Override
    public List<CatalogItem> getDepartmentCatalogList() {
        return catalogMapper.getDepartmentCatalogList();
    }

    //查询用户列表
    @Override
    public List<CatalogItem> getUserCatalogList() {
        return catalogMapper.getUserCatalogList();
    }

    //查询角色列表
    @Override
    public List<CatalogItem> getRoleCatalogList() {
        return catalogMapper.getRoleCatalogList();
    }


    //查询菜单列表
    @Override
    public List<CatalogItem> getMenuCatalogList(){
        return catalogMapper.getMenuCatalogList();
    }

    //查询icon列表
    @Override
    public List<CatalogItem> getIconCatalogList(){
        return catalogMapper.getIconCatalogList();
    }

    //查询字典类型
    @Override
    public List<CatalogItem> getDictionaryTypeCatalogList() {
        return catalogMapper.getDictionaryTypeCatalogList();
    }

    //依据类型，查询icon列表
    @Override
    public List<CatalogItem> getIconCatalogListByTypeId(Long typeId) {
        return catalogMapper.getIconCatalogListByTypeId(typeId);
    }

    //根据类型查询图元
    @Override
    public List<CatalogItem> getTupleCatalogListByTypeId(Long typeId) {
        return catalogMapper.getTupleCatalogListByTypeId(typeId);
    }

    //根据masterId和fieldType查询
    @Override
    public List<CatalogItem> getPermissionCatalogListByMasterId(Map<String, Object> map) {
        return catalogMapper.selectPermissionCatalogListByMasterId(map);
    }
}
